# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.spark_submit import SparkSubmitOperator

from jms.dim.dim_network_whole_massage import jms_dim__dim_network_whole_massage
from jms.dim.dim_lmdm_sys_first_code import jms_dim__dim_lmdm_sys_first_code
from jms.dwd.tab.dwd_tab_barscan_centerarrival_base_dt import jms_dwd__dwd_tab_barscan_centerarrival_base_dt
from jms.dwd.tab.dwd_tab_barscan_centersend_base_dt import jms_dwd__dwd_tab_barscan_centersend_base_dt
from jms.dwd.tab.dwd_tab_barscan_taking_base_dt import jms_dwd__dwd_tab_barscan_taking_base_dt
from jms.dwd.tab.dwd_tab_barscan_warehousing_base_dt import jms_dwd__dwd_tab_barscan_warehousing_base_dt
from jms.dwd.tab.dwd_tab_barscan_sitearrival_base_dt import jms_dwd__dwd_tab_barscan_sitearrival_base_dt
from jms.dwd.oms.dwd_yl_oms_oms_waybill_incre_dt import jms_dwd__dwd_yl_oms_oms_waybill_incre_dt
from jms.dwd.tab.dwd_barscan_bagging_dt import jms_dwd__dwd_barscan_bagging_dt
from jms.dim.dim_lmdm_sys_network_distributi import jms_dim__dim_lmdm_sys_network_distributi
from jms.dim.sqs.dim_problem_express_wo_record_base import jms_dim__dim_problem_express_wo_record_base
from jms.time_sensor.time_after_05_00 import time_after_05_00

dm__dm_transfor_center_package_detail = SparkSubmitOperator(
    task_id='dm__dm_transfor_center_package_detail',
    pool_slots=5,
    task_concurrency=1,  # 如果任务不支持并发，则将 task_concurrency 设为 1
    name='dm__dm_transfor_center_package_detail_{{ execution_date | cst_ds }}',
    driver_memory='12G',
    executor_memory='10G',
    executor_cores=6,
    num_executors=30,
    email=['guoruiling@jtexpress.com','yl_bigdata@yl-scm.com'],
    conf={'spark.executor.memoryOverhead': 4096,
          'spark.core.connection.ack.wait.timeout': 5000,
          'spark.default.parallelism': 200,
          'spark.sql.shuffle.partitions': 500,
          'spark.locality.wait': 60,
          'spark.driver.maxResultSize': 20
          },
    java_class='com.yunlu.bigdata.jobs.export.ExportTransforCenterPackageDetail',
    application='hdfs:///scheduler/jms/spark/zyt/transfor_center_package/TransforCenterPackage.jar',
    application_args=['{{ execution_date | cst_ds }}'],
    execution_timeout=timedelta(minutes=120),
)

dm__dm_transfor_center_package_detail << [
    jms_dim__dim_network_whole_massage,
    jms_dim__dim_lmdm_sys_first_code,
    jms_dwd__dwd_tab_barscan_centerarrival_base_dt,
    jms_dwd__dwd_tab_barscan_centersend_base_dt,
    jms_dwd__dwd_barscan_bagging_dt,
    jms_dim__dim_lmdm_sys_network_distributi,
    jms_dwd__dwd_tab_barscan_taking_base_dt,
    jms_dwd__dwd_tab_barscan_warehousing_base_dt,
    jms_dwd__dwd_tab_barscan_sitearrival_base_dt,
    jms_dwd__dwd_yl_oms_oms_waybill_incre_dt,
    time_after_05_00,
    jms_dim__dim_problem_express_wo_record_base
]